<template>
    <header id="header" class="header">
        <div class="header-logo">
            医检 <span>云</span>
        </div>
        <div class="header-user">
            <i class="fa fa-user-o"></i> {{ user.username }} <span style="margin-left: 15px;cursor: pointer" @click="logout()"><i class="fa fa-power-off"></i> 退出</span>
        </div>
    </header>
</template>

<script>
    export default {
        data: function() {
            return {
                user: JSON.parse(this.$cookie.get('user')),
            }
        },
        methods:{
            logout() {
                this.$store.dispatch('userLogout').then(()=>{
                    this.$notify({ type: 'success', duration:1000, title: 'SUCCESS', message: '正在退出......', onClose:()=>{
                            this.$router.push({name:'Login'});
                        }});
                });
            }
        }
    }
</script>
